]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
avatar: Use Property bindings to sync reactivity
authorMarco Trevisan (Treviño) <mail@3v1n0.net>
Fri, 30 Aug 2019 23:32:03 +0000 (01:32 +0200)
committerFlorian Müllner <florian.muellner@gmail.com>
Wed, 16 Oct 2019 15:26:13 +0000 (15:26 +0000)
Instead of manually updating properties on change, use native properties
bindings to keep the them synchronized.

Disable hover-tracking and focus-ability when the avatar is not sensitive.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/559

js/ui/userWidget.js

index 5cd4bb36ddcc3ec8195e86edb21b2f08492be7b4..9dcc60f40c63fe375643e9352021894f981ffb85 100644 (file)
@@ -25,7 +25,6 @@ var Avatar = GObject.registerClass({
 
         super._init({
             style_class: params.styleClass,
-            track_hover: params.reactive,
             reactive: params.reactive,
             width: params.iconSize * themeContext.scaleFactor,
             height: params.iconSize * themeContext.scaleFactor
@@ -34,6 +33,11 @@ var Avatar = GObject.registerClass({
         this._iconSize = params.iconSize;
         this._user = user;
 
+        this.bind_property('reactive', this, 'track-hover',
+            GObject.BindingFlags.SYNC_CREATE);
+        this.bind_property('reactive', this, 'can-focus',
+            GObject.BindingFlags.SYNC_CREATE);
+
         // Monitor the scaling factor to make sure we recreate the avatar when needed.
         this._scaleFactorChangeId =
             themeContext.connect('notify::scale-factor', this.update.bind(this));
@@ -50,7 +54,6 @@ var Avatar = GObject.registerClass({
     }
 
     setSensitive(sensitive) {
-        this.can_focus = sensitive;
         this.reactive = sensitive;
     }